package com.tang.service.impl;

import com.tang.repository.ReaderRepository;
import com.tang.repository.impl.AdminRepositoryImpl;
import com.tang.repository.impl.ReaderRepositoryImpl;
import com.tang.service.LoginService;


/**
 * @author tang
 * @create 2020-08-16
 */

/**
 * 处理登录的具体业务
 */
public class LoginServiceImpl implements LoginService {


    @Override
    public Object login(String username, String password,String type) {
        Object object = null;
        switch (type){
            case "reader":
                ReaderRepository readerRepository =  new ReaderRepositoryImpl();
                object =  readerRepository.login(username,password);
                break;
            case  "admin":
                AdminRepositoryImpl adminRepository = new AdminRepositoryImpl();
                object = adminRepository.login(username,password);
                break;
        }

        return object;
    }
}
